<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        body {
            background-color: gray;
            overflow: hidden;
        }
        
        button {
            position: absolute;
        }
        
        .lightgreen {
            position: absolute;
            transform: translateX(100vw);
            width: 50vw;
            height: 100vh;
            background-color: lightgreen;
            transition: all .5s;
        }
        
        .move {
            transform: translateX(50vw);
        }
    </style>
</head>

<body>
    <div id="app">
        <button v-on:click="fn">点击</button>
        <div class="lightgreen" v-bind:class="classObj"></div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                classObj: {
                    move: false
                }
            },
            methods: {
                fn() {
                    this.classObj.move = !this.classObj.move
                }
            }
        })
    </script>
</body>

</html>